//
//  LLDatePickerView.m
//  LoveLife
//
//  Created by nonoking on 2017/7/13.
//  Copyright © 2017年 nonoking. All rights reserved.
//

#import "LLDatePickerView.h"

#import "NSDate+FFExpansion.h"

//#import "LLBaseDefine.h"



@interface LLDatePickerView()
@property (weak, nonatomic) IBOutlet UIDatePicker *datePicker;

@end

@implementation LLDatePickerView


+ (instancetype)datePicer
{
    NSBundle *crrentBundle = [NSBundle bundleForClass:[self class]];
    LLDatePickerView *picker = [[crrentBundle loadNibNamed:@"LLDatePickerView" owner:nil options:nil]firstObject];
    
    return picker;
}

+ (instancetype)datePicerWithFrame:(CGRect)frame
{
    NSBundle *crrentBundle = [NSBundle bundleForClass:[self class]];
    LLDatePickerView *picker = [[crrentBundle loadNibNamed:@"LLDatePickerView" owner:nil options:nil]firstObject];
    picker.frame = frame;
    return picker;
}

- (instancetype)initWithCoder:(NSCoder *)aDecoder
{
    if (self = [super initWithCoder:aDecoder]) {
//        NSLog(@"123");
//        [self setupUI];
    }
    return self;
}

- (void)awakeFromNib
{
    [super awakeFromNib];
    
    [self setupUI];
}

- (void)dealloc
{
    NSLog(@"dealloc");
}

#pragma mark - 设置ui
- (void)setupUI
{
    self.datePicker.datePickerMode = UIDatePickerModeDate;
    [self.datePicker setLocale:[[NSLocale alloc]initWithLocaleIdentifier:@"zh_CN"]];
    // 设置时区
    [self.datePicker setTimeZone:[NSTimeZone localTimeZone]];
    self.datePicker.date = [NSDate date];
    self.datePicker.maximumDate = [NSDate date];
    [self.datePicker addTarget:self action:@selector(datePickerValueChanged:) forControlEvents:UIControlEventValueChanged];
    
}

#pragma mark - 设置数据
- (void)vcLoadDatasourse
{
    
}

#pragma mark - 注册通知和实现
- (void)vcRegistNotific
{
    
}

#pragma mark - 懒加载

#pragma mark - 点击事件
- (void)datePickerValueChanged:(UIDatePicker *)sender
{
    if (self.Selectedhandle) {
        self.Selectedhandle([NSDate ff_dateToTimeStr:sender.date dateFormatter:@"yyyy-MM-dd"]);
    }
    
}
#pragma mark - 业务逻辑
- (void)currSelectedDate:(void(^)(NSString *dateStr))selectDate
{
    
}

#pragma mark - 自定义代理
@end
